From : Timo Suoranta (tksuoran@cc.helsinki.fi)
Subject : Dual playfield with scrolling
> As for colours, probably 8 for bkgrnd, 8 for forgrnd/plys/bullets etc, to
> keep up the speed AMAP.

Ok no problems now on totally separate bitmaps... :


DEFTYPE .w      ; Mostly used
WBStartup       ; Nice to have
CloseEd         ; Some memory
NoCli           ; Not needed

BACK_BM =   0   ; Background bitmap number
FORE_BM =   1   ; Foreground bitmap number
MXX     = 800   ; Main bitmap width
MYY     = 500   ; Main bitmap height
FBP     =   3   ; Foreground bitmap depth
BBP     =   3   ; Background bitmap depth
TOP_CL  =   0   ; Top copperlist number
BOT_CL  =   1   ; Bottom copperlist number
TOP_PAL =   0   ; Top copperlist palette
BOT_PAL =   1   ; Bottom copperlist palette

VYP     =  28   ; Viewport YPosition
VXX     = 320   ; Viewport width
VYY     = 140   ; Viewport height
VHX     = VXX/2 ; Viewport middle x-pos
VHY     = VYY/2 ; Viewport middle y-pos

; Do couple of nice palettes
For i=2 To 7                                            ; 0-7 is
  PalRGB TOP_PAL, i, 15-i,15-i/2,15                     ; the
  PalRGB BOT_PAL, i, 15-i,15-i/2,15                     ; foreground
Next                                                    ;
For i=2 To 7                                            ; 8-15 is
  PalRGB TOP_PAL, i+8, 8-i, i/3+3 ,i*3/2+1              ; the
  PalRGB BOT_PAL, i+8, 9-i, i/3+3 ,i*3/2+1              ; background
Next                                                    ;
PalRGB TOP_PAL, 0, 0,0,0 : PalRGB TOP_PAL, 9, 13,10,15  ;
PalRGB BOT_PAL, 0, 0,0,0 : PalRGB BOT_PAL, 9, 13,10,15  ;

; Do nice background bitmap
BitMap BACK_BM, MXX, MYY, BBP
Cls 0
For i=1 To 6 : Boxf (i-1)*MXX/6,0,i*MXX/6,MYY,i+1 :Next
For i=0 To 800
  x = Rnd(MXX-2)
  y = Rnd(MYY-2)
  Plot  x  ,y  ,1
  Plot  x+1,y+1,0
Next
Box 0,0,MXX-1,MYY-1,1
Box 1,1,MXX-2,MYY-2,0

; Do nice foreground bitmap
BitMap FORE_BM, MXX, MYY, FBP
Cls 0
For i=0 To 100
  x = Rnd(MXX-10)
  y = Rnd(MYY-10)
  Circle x,y, Rnd(4)+4,Rnd(7)+1
Next

; Initialize copperlists
InitCopList TOP_CL, VYP      , VYY, $30+FBP+BBP, 8, 32, 0
InitCopList BOT_CL, VYP+VYY+2, VYY, $30+FBP+BBP, 8, 32, 0
DisplayBitMap TOP_CL, FORE_BM ,0,0, BACK_BM ,0,0
DisplayBitMap BOT_CL, FORE_BM ,0,0, BACK_BM ,0,0
DisplayPalette TOP_CL, TOP_PAL
DisplayPalette BOT_CL, BOT_PAL

; It's showtime!
BLITZ : Mouse On
CreateDisplay MAIN_DP, TOP_CL, BOT_CL
MouseArea VHX,VHY,MXX-VHX+1,MYY-VHY+1     ; <- Note the area for players

Repeat
  p1_x = MouseX                           ; Let the player
  p1_y = MouseY                           ;  go around...
  p2_x = MXX-MouseX                       ; This could be the
  p2_y = MYY-MouseY                       ;  main frame-loop

  tx = p1_x -VHX : bx = p2_x -VHX         ; Valc bitmaps' offsets
  ty = p1_y -VHY : by = p2_y -VHY         ;  from middlepoints
  DisplayBitMap TOP_CL, FORE_BM, tx/2, ty/2, BACK_BM, tx, ty
  DisplayBitMap BOT_CL, FORE_BM, bx/2, by/2, BACK_BM, bx, by
Until Joyb(0)=3                           ; Wait for both mbuttons

That's it, hope you like it. When you wanna display a sprite and you got 
its bitmap coords, just add VHX,VHY to those and check the new 
value fits inside corresponding viewport.

Sorry about the lame parallax effect (it goes wrong), in your case you 
just keep the both parameters same.